package io.lckgroup.modules.lck.controller.wxgzh;

import io.lckgroup.common.utils.PageUtils;
import io.lckgroup.common.utils.R;
import io.lckgroup.modules.lck.service.ShopFoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 公众号点餐菜品查询
 */
@RestController
@RequestMapping("/mp/wxFood")
public class WxFoodController {

    @Autowired
    private ShopFoodService shopFoodService;

    /**
     * 根据商家id获取商家菜品信息
     *
     * @param merchantId 商家id
     * @return
     */
    @GetMapping("/wxget/{merchantId}")
//    @WxLogin
//    @Cacheable(value = "foodMenuList", key = "#merchantId")
    public R getFood(@PathVariable Integer merchantId) {
        List foodList = shopFoodService.getFoodList(merchantId);
        return R.ok().put("data", foodList);
    }

    @GetMapping("/wxFoodList")
//    @WxLogin
    public R allFood(@RequestParam Map<String, Object> params) {
        PageUtils page = shopFoodService.queryByPage(params);
        return R.ok().put("page", page);
    }
}
